package com.ktwlsoft.archivemanage.domain.dao.repository;

import java.time.Year;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.ktwlsoft.archivemanage.payload.transfer.TransferDetail;
import com.ktwlsoft.archivemanage.payload.transfer.TransferDetailList;
import com.ktwlsoft.archivemanage.payload.transfer.TransferListResponse;
import com.ktwlsoft.archivemanage.payload.unitArchiveManage.Archive;
import com.ktwlsoft.archivemanage.payload.unitArchiveManage.ArchiveUnitStatics;
import org.apache.ibatis.annotations.Mapper;
import com.ktwlsoft.archivemanage.domain.dao.entity.UnitArchiveManage;
import org.springframework.stereotype.Repository;

/**
 * unit_archive_manage--室藏档案管理
 *
 * @author zhuhe on 2019-10-24 14:19:44
 * @version 1.0
 */
@Mapper
@Repository
public interface IUnitArchiveManageMapper {
	
	/**
	 * 查询列表 on 2019-10-24 14:19:44
	 * @param unitArchiveManage unitArchiveManage
	 * @return List<UnitArchiveManage>
	 */
	List<UnitArchiveManage> findList(UnitArchiveManage unitArchiveManage);

	/**
	 * 查询列表 on 2019-10-29 09:23:56
	 * @param data
	 * @return List<Map<String,Object>>
	 */
	List<Map<String,Object>> findUnitArchiveManageList(Map<String,Object> data);

	/**
	 * @description 查询室藏档案管理信息
	 * @param data
	 * @return Map<String,Object>
	 */
	Map<String,Object> findUnitArchiveManageInfo(Map<String,Object> data);

	/**
	 * 查询起止年份
	 * @param unitId
	 * @return Map<String,Object>
	 */
	Map<String,Object> findBeginAndEndYear(Long unitId);

	/**
	 * @description 添加室藏档案管理
	 * @param unitArchiveManage
	 * @return int
	 */
	int addUnitArchiveManage(UnitArchiveManage unitArchiveManage);

	/**
	 * @description 删除室藏档案管理
	 * @param id
	 * @return int
	 */
	int deleteUnitArchiveManage(Long id);

	/**
	 * @description 更新室藏档案管理
	 * @param unitArchiveManage
	 * @return int
	 */
	int updateUnitArchiveManage(UnitArchiveManage unitArchiveManage);

	/**
	 * @description 更新对比确认状态
	 * @param unitArchiveManage
	 * @return int
	 */
	int updateCompareConfirm(UnitArchiveManage unitArchiveManage);

	/**
	 * 根据id查询信息 on 2019-10-24 14:19:44
	 * @param id id
	 * @return UnitArchiveManage
	 */
	UnitArchiveManage getById(Long id);
	
	
	/**
	 * 根据id删除信息 on 2019-10-24 14:19:44
	 * @param id id
	 * @return int
	 */
	int deleteById(Long id);
	
	/**
	 * 根据id集合批量删除信息 on 2019-10-24 14:19:44
	 * @param ids ids
	 * @return int
	 */
	int deleteByIds(List<Long> ids);
	


	/**
	 * 插入 on 2019-10-24 14:19:44
	 * @param unitArchiveManage unitArchiveManage
	 * @return int
	 */
    int insert(UnitArchiveManage unitArchiveManage);

	/**
	 * 更新 on 2019-10-24 14:19:44
	 * @param unitArchiveManage unitArchiveManage
	 * @return int
	 */
    int update(UnitArchiveManage unitArchiveManage);

    List<TransferListResponse> findTransferListByPage(String keywords, Boolean transfered);

	TransferDetail findTransferDetailById(Long id);

	List<TransferDetailList> findTransferDetailListByUnitId(Long unitId, String field, String order);

	/**
	 * 查询单位室藏档案详情统计
	 * @param unitId
	 * @return
	 */
	TransferDetail findDetailByUnitId(Long unitId);

    int setTransfered(Long businessId, String realName, Long userId, String transferRemark, Date date);

    int cancelTransfer(Long businessId, String realName, Long userId, String transferRemark, Date date);

    List<UnitArchiveManage> findByPage(Long unitId, String field, String order);

	UnitArchiveManage findByUnitAndYear(Long unitId, Year writeDate);

	ArchiveUnitStatics findUnitStatics(Long unitId);

	List<Archive> findUnitArchiveTypesStatistic(Long unitId);
}
